#include<iostream>
using namespace std;
int main()
{
	int n;
	cin >> n;
	char arr[11];
	getchar();
	while (n--)
	{
		cin >> arr;
		//cout << 6 << k % 100000 << endl;
		cout << 6;
		for (int i = 6; i < 11; i++) {
			cout << arr[i];
		}
		cout << endl;	
	}
	return 0;
}